package com.mi9688.method_quote;

public class Test01 {
    /**
     *
     * 静态方法引入
     */
    public static void main(String[] args) {
        //传统匿名内部类方式
        new MessageInterface(){

            @Override
            public void printMessage(String msg) {
                System.out.println("打印内容:"+msg);
            }
        }.printMessage("hello");


        //使用Lambda
        ((MessageInterface) msg -> System.out.println("打印内容:" + msg)).printMessage("hello");

        //静态方法引入
        MessageInterface m=Test01::staticPrintMessage;
        m.printMessage("hello");
        //简化的写法
        ((MessageInterface) Test01::staticPrintMessage).printMessage("hello");


    }
    //定义静态方法
    public static String staticPrintMessage(String msg){
        System.out.println("打印内容:"+msg);
        return msg;
    }
}
